package com.gwz.cardserver.dto;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import org.springframework.beans.BeanUtils;

@Data
public class ResBase<T> {
    private int resCode;
    private int code;
    public int subCode;
    private T result;


    public static String success(ReqBase reqBase,Object result){
        ResBase resBase=new ResBase();
        BeanUtils.copyProperties(reqBase,resBase);
        resBase.setResCode(200);
        resBase.setResult(result);
        return  JSON.toJSONString(resBase);
    }

    public static String fall(ReqBase reqBase,Object result){
        ResBase resBase=new ResBase();
        BeanUtils.copyProperties(reqBase,resBase);
        resBase.setResCode(500);
        resBase.setResult(result);
        return JSON.toJSONString(resBase);
    }

}
